<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitUpdate18 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('order_skus', function (Blueprint $table) {
            $table->string('group_price_title', 30)->nullable()->comment('专享价标题');
            $table->json('options')->nullable()->comment('其它信息');
        });

        Schema::table('products', function (Blueprint $table) {
            $table->string('group_price_title', 30)->nullable()->comment('专享价标题');
            $table->json('options')->nullable()->comment('其它信息');
            $table->integer('carriage')->nullable()->comment('运费');
        });

        Schema::table('orders', function (Blueprint $table) {
            $table->integer('carriage_type')->default(1)->comment('支付类型: 1为在线支付邮费  2为到付');
        });

        Schema::table('activity_egg_lottery', function (Blueprint $table) {
            $table->string('body_image')->nullable()->comment('扭蛋机机身图片');
            $table->string('btn_1')->nullable()->comment('扭1次图片');
            $table->string('btn_1_on')->nullable()->comment('扭1次图片');
            $table->string('btn_5')->nullable()->comment('扭1次图片');
            $table->string('btn_5_on')->nullable()->comment('扭1次图片');
            $table->string('btn_try')->nullable()->comment('试一试图片');
            $table->string('btn_try_on')->nullable()->comment('试一试图片');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('order_skus', function (Blueprint $table) {
            $table->dropColumn('group_price_title');
            $table->dropColumn('options');
        });

        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn('group_price_title');
            $table->dropColumn('options');
            $table->dropColumn('carriage');
        });

        Schema::table('orders', function (Blueprint $table) {
            $table->dropColumn('carriage_type');
        });

        Schema::table('activity_egg_lottery', function (Blueprint $table) {
            $table->dropColumn('body_image');
            $table->dropColumn('btn_1');
            $table->dropColumn('btn_1_on');
            $table->dropColumn('btn_5');
            $table->dropColumn('btn_5_on');
            $table->dropColumn('btn_try');
            $table->dropColumn('btn_try_on');
        });
    }
}
